<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">

    <assetUser-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></assetUser-form>
  </j-modal>
</template>

<script>

  import AssetUserForm from './AssetUserForm'
  export default {
    name: 'AssetUserModal',
    components: {
      AssetUserForm
    },
    props: {
      isAudit: {
        type: Number,
        default: 0
      },
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
      }
    },
    methods: {
      // 新增
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      // 编辑、详情
      edit(record,batchDatas,type) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record,batchDatas,type);
        })
        console.log('edit->',record,batchDatas,type)
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      handleClose(){
        this.close()
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>
<style scoped>
  .toolBt{
    display: flex;
    align-content: center;
  }
</style>